<template>
  <a :href="site.url" target="_blank" rel="noopener noreferrer" class="site-card">
    <div class="site-icon">
      <i :class="site.icon"></i>
    </div>
    <div class="site-info">
      <h3 class="site-title">{{ site.name }}</h3>
      <p class="site-desc">{{ site.description }}</p>
    </div>
    <div class="site-arrow">
      <i class="ri-arrow-right-line"></i>
    </div>
  </a>
</template>

<script setup>
defineProps({
  site: {
    type: Object,
    required: true,
  },
})
</script>

<style lang="scss" scoped>
.site-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-lighter);
  text-decoration: none;
  transition: var(--transition-base);
  cursor: pointer;

  &:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-light);
    background: var(--bg-hover);

    .site-icon {
      background: var(--color-primary);
      color: #fff;
      transform: scale(1.1);
    }

    .site-title {
      color: var(--color-primary);
    }

    .site-arrow {
      transform: translateX(4px);
      color: var(--color-primary);
    }
  }

  .site-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-base);

    i {
      font-size: 28px;
      color: var(--text-primary);
      transition: var(--transition-base);
    }
  }

  .site-info {
    flex: 1;
    min-width: 0;

    .site-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 6px;
      transition: var(--transition-base);
    }

    .site-desc {
      font-size: 14px;
      color: var(--text-regular);
      line-height: 1.5;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
  }

  .site-arrow {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 20px;
    transition: var(--transition-base);
  }
}

@media (max-width: 768px) {
  .site-card {
    padding: 16px;
    gap: 12px;

    .site-icon {
      width: 48px;
      height: 48px;

      i {
        font-size: 24px;
      }
    }

    .site-info {
      .site-title {
        font-size: 15px;
      }

      .site-desc {
        font-size: 13px;
      }
    }
  }
}
</style>
